import java.util.ArrayList;
import java.util.List;


/**
 * @author LKQ
 * @date 2021/12/21 14:08
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.getHint("1122", "0001"));
    }

    public String getHint(String secret, String guess) {
        int n = secret.length();
        int A = 0, B = 0;
        List<Integer> listA = new ArrayList<>();
        List<Integer> listB = new ArrayList<>();
        for (int i = 0 ; i < n; i++) {
            if (secret.charAt(i) == guess.charAt(i)) {
                A++;
            }else {
                listA.add(Integer.parseInt(secret.substring(i, i+1)));
                listB.add(Integer.parseInt(guess.substring(i, i+1)));
            }
        }
        for (Integer a : listA) {
            if (listB.contains(a)) {
                listB.remove(a);
                B++;
            }
        }
        return A + "A" + B + "B";
    }

}
